package com.aishua.fire.controller.activiti;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

import com.aishua.fire.entity.emergencyPre.PositionRespInfo;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class SignTaskListen implements TaskListener{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void notify(DelegateTask delegateTask) {
		Map<String, Object> variables = delegateTask.getVariables();
		List<PositionRespInfo> positionInfos = (List<PositionRespInfo>) variables.get("ss");
		log.info("ss:{}",variables.get("ss"));
		log.info("positionInfos:{}",positionInfos);
		List<String> userIds = new ArrayList<String>();
		for (PositionRespInfo positionInfo : positionInfos) {
			userIds.add(positionInfo.getPosition_id());
			log.info("Position_id:{}",positionInfo.getPosition_id());
		}
		
		delegateTask.addCandidateUsers(userIds);
	}

}
